package com.clqteam.serviceimpl;

import java.util.List;

import com.clqteam.dao.ShowTempOrderDao;
import com.clqteam.daoimpl.ShowTempOrderDaoImpl;
import com.clqteam.model.Product;
import com.clqteam.service.ShowTempOrderService;

import net.sf.json.JSONObject;

public class ShowTempOrderServiceImpl implements ShowTempOrderService{

	ShowTempOrderDao stoDao = new ShowTempOrderDaoImpl();
	
	@Override
	public JSONObject findTempOrder(String tbName) {
		JSONObject j = new JSONObject();
		int total = stoDao.getTotalTempOrder(tbName);
		j.put("total", total);
		List<Product> pros = stoDao.getTempOrder(tbName);
		j.put("rows", pros);
		return j;
	}

	@Override
	public int deleteTempOrderInfoByPId(int pId,String tbName) {
		
		return stoDao.deleteTempOrderInfoByPId(pId,tbName);
	}

	@Override
	public int updateTempOrderInfoByPId(int newAmount,int pId, String tbName) {
		
		return stoDao.updateTempOrderInfoByPId(newAmount, pId, tbName);
	}

}
